package 数学;

import java.io 

.IOException;
import java.util.Vector;

public class 完数 {
	public static void fenjie(Vector<Integer>m,int n)
	{
		for (int i = 0; i<=n/2; i++) 
		if(n%i==0)
			m.addElement(i);
		}

	public static boolean panBie(Vector<Integer> m, int n) {
		int sum = 0;
		for (int i = 0; i < m.size(); i++)
			sum = sum + m.elementAt(i);
		if (sum == n)
			return true;
		else
			return false;
	}

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		boolean zhenjia = false;
		System.out.println("1000以内的完数为：");
		for (int i = 2; i < 1000; i++) {
			Vector<Integer> pool = new Vector<Integer>();
			fenjie(pool, i);
			zhenjia=panBie(pool, i);
			if (zhenjia)
				System.out.println(i);
		}
	}
}

